---@class UIFriendShowInfo : UIComponentBase
local UIFriendShowInfo = Class("",UIComponentBase)
local t = UIFriendShowInfo

function t:ctor(obj)
    self.fguiObj = obj
    self:OnCreate()
end

function t:OnCreate()
    local head = self:GetChild("Head")
    self.icon = self:GetChild("Icon",head)
    self.headFrame = self:GetChild("headframe")
    self.level = self:GetChild("Level")
    self.name = self:GetChild("playerNameQuery")
    self.power = self:GetChild("powerQuery")
    self.guild = self:GetChild("guildQuery")
    self.location = self:GetChild("LBSQuery")
    self.reason = self:GetChild("reasonQuery")
    self.btnAdd = self:GetChild("confirmQuery")
    self.btnClose = self:GetChild("btnCloseQuery")

    self:RegisterOnClick(self.btnAdd,self.ClickAdd)
    self:RegisterOnClick(self.btnClose,self.ClickClose)
end

function t:OnEnable()

end
function t:OnDisable()
end
function t:OnDestroy()
    self.fguiObj = nil
end
---@param friend ClientFriendInfo
function t:Refresh(friend)
    self.friendId = friend.playerId
    self:SetPlayerIcon(self.icon,friend.pic,self.headFrame,friend.picFrame)
    self.power.text = getNumString(friend.maxPower)
    self.name.text = friend.name
    self.level.text = friend.level
    self.guild.text = "工会：无"
    self.location.text = friend.lbs
    self.reason.text = friend:GetReason()
end
function t:ClickAdd()
    FireEvent(Config.EventType.FriendShowAddMessage,true,self.friendId)
    self:ClickClose()
end
function t:ClickClose()
    FireEvent(Config.EventType.FriendShowDetail,false)
end
return t